package com.rx.dao;

import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import com.rx.common.DBUtils;
import com.rx.entity.Logs;

public class LogsDaoImpl implements LogsDaoI<Logs> {

	@Override
	public boolean insert(Logs logs) throws SQLException {
		Connection conn = DBUtils.getConnection();
		String sql = "INSERT INTO  logs (operateType,content,operateDate) VALUES(?,?,?)";
		// 创建PreparedStatement
		PreparedStatement ps = conn.prepareStatement(sql);
		ps.setInt(1, logs.getOperateType());
		ps.setString(2, logs.getContent());
		//添加当前日期
		ps.setDate(3, new Date(new java.util.Date().getTime()));
		// 执行语句
		if (ps.executeUpdate() > 0) {
			return true;
		}
		DBUtils.close(conn, ps, null);
		return false;
	}

	@Override
	public List<Logs> selectAll() {
		return null;
	}

	@Override
	public boolean delete(int id) {
		return false;
	}

	@Override
	public boolean update(Logs t) throws Exception {
		return false;
	}

	@Override
	public List<Logs> selectWhere(String whereSql) throws Exception {
		return null;
	}

}
